import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  TouchableOpacity,
  Platform,
  ScrollView
} from 'react-native';

import { AutoGrowingTextInput } from 'react-native-autogrow-textinput';
import { public_Style as styles } from '../../styles';

var Dimensions = require('Dimensions');
var width = Dimensions.get('window').width;
var height = Dimensions.get('window').height;

export default class Autoinput extends Component {
  constructor(props) {
    super(props);
    // this.state = { textValue: null };
  }

  render() {
    return (
      <ScrollView style={styles.allinput}>
        <AutoGrowingTextInput style={styles.textInput}
          underlineColorAndroid="transparent"
          placeholder="请输入内容"
          defaultValue={this.props.text}
          onChangeText={this.text.bind(this)}
          autoFocus={true} />

      </ScrollView>
    );
  }

  text(a) {
    this.props.function(a);
  }

  // _onChange(event) {
  //   this.setState({ textValue: event.nativeEvent.text || '' });
  // }

  // _resetTextInput() {
  //   this._textInput.clear();
  //   this._textInput.resetHeightToMin();
  // }
}

const IsIOS = Platform.OS === 'ios';


